﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using eProject_SEM3_SecurityServices.ObjectClass;

namespace eProject_SEM3_SecurityServices.DataAccess
{
    public class DTaskOfEmployee
    {
        public List<TaskOfEmployee> getListTask()
        {
            List<TaskOfEmployee> listTask = null;

            using (DataTable table = DConnectSQL.ExecuteSelectCommand("sp_listCustomerServices",CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    listTask = new List<TaskOfEmployee>();

                    foreach (DataRow row in table.Rows)
                    {
                        TaskOfEmployee task = new TaskOfEmployee();
                        task.ServiceName = row["serviceName"].ToString();
                        task.StartDate = row["startDay"].ToString();
                        task.EndDate = row["endDay"].ToString();

                        listTask.Add(task);
                    }
                }
            }
            return listTask;
        }
    }
}